package com.ty.day2;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create 2023/11/7 14:39
 */
public class Four {
    public static void main(String[] args) {
        long begin = System.currentTimeMillis();
        long result = factorial(20);
        System.out.println(result);
        long end = System.currentTimeMillis();
        System.out.println(end - begin);
    }

    public static long factorial(int x) {
        if (x > 1) {
            return x * factorial(x - 1);
        } else {
            return 1;
        }
    }
}
